package com.taotao.controller;

import com.taotao.EasyUIDataGridResult;
import com.taotao.TaotaoResult;
import com.taotao.service.ItemParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by mafuhua on 2017/9/20.
 */
@Controller
@RequestMapping("/item/param")
public class ItemParamController {
    @Autowired
    private ItemParamService itemParamService;


    @RequestMapping("/list")
    @ResponseBody
    private EasyUIDataGridResult getItemParamList(@RequestParam(defaultValue = "1") Integer page,
                                                  @RequestParam(defaultValue = "30") Integer rows) {
        System.out.println("hhhhhhhhhhh");
        EasyUIDataGridResult itemList = itemParamService.getItemList(page, rows);
        System.out.println(itemList);
        return itemList;
    }


    @RequestMapping("/query/itemcatid/{cid}")
    @ResponseBody
    private TaotaoResult getItemCatByCid(@PathVariable long cid) {
        TaotaoResult itemParamByCid = itemParamService.getItemParamByCid(cid);
        return itemParamByCid;
    }

    @RequestMapping("/save/{cid}")
    @ResponseBody
    private TaotaoResult insertItemParam(@PathVariable long cid, String paramData) {
        TaotaoResult itemParamByCid = itemParamService.insertItemParam(cid, paramData);
        return itemParamByCid;
    }
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ResponseBody
    private TaotaoResult insertItemParam(long ids) {
        TaotaoResult itemParamByCid = itemParamService.delItemParam(ids);
        return itemParamByCid;
    }


}
